<include file="public/layout" />
<body style="background-color: #FFF; overflow: auto;">
<div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
            <div class="subject">
                <h3>户主管理 - 审核户主</h3>
                <h5>网站系统审核户主</h5>
            </div>
        </div>
    </div>
    <form class="form-horizontal" method="post" id="add_form" enctype="multipart/form-data">
        <div class="ncap-form-default">
            <input type="hidden" name="id" id="id" class="input-txt" value="{$list.id}">
            <dl class="row">
                <dt class="tit">
                    <label for="username"><em>*</em>户主姓名</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="username" id="username" class="input-txt" value="{$list.username}">
                    <span class="err"></span>
                    <p class="notic"></p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="phone"><em>*</em>手机号</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="phone" id="phone" class="input-txt" value="{$list.phone}">
                    <span class="err"></span>
                    <p class="notic">请输入11位手机号码</p>
                </dd>
            </dl>
            <!--<dl class="row">-->
                <!--<dt class="tit">-->
                    <!--<label for="pic"><em>*</em>头像</label>-->
                <!--</dt>-->
                <!--<dd class="opt">-->
                    <!--<input type="file" name="pic" id="pic" class="input-txt" value="{$list.pic}">-->
                    <!--<span class="err"></span><img src="/public/upload/pic/{$list.pic|default='default.jpg'}" style="width: 50px;height: 50px;">-->
                    <!--<p class="notic"></p>-->
                <!--</dd>-->
            <!--</dl>-->

            <dl class="row">
                <dt class="tit">
                    <label for="card"><em>*</em>身份证号</label>
                </dt>
                <dd class="opt">
                    <input type="text" name="card" id="card" class="input-txt" value="{$list.card}">
                    <span class="err"></span>
                    <p class="notic">请输入居民身份证号</p>
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="consignee"><em>*</em>地址</label>
                </dt>
                <dd class="opt">
                    <select onchange="get_city(this)" id="province" name="province"  title="请选择所在省份">
                        <option value="">选择省份</option>
                        <volist name="province" id="vo">
                            <option value="{$vo.id}" >{$vo.name}</option>
                        </volist>
                    </select>
                    <select  id="city" onchange="get_area(this)" name="city" title="请选择所在城市">
                        <option value="">选择城市</option>
                        <volist name="city" id="vo">
                            <option value="{$vo.id}">{$vo.name}</option>
                        </volist>
                    </select>
                    <select id="district" onchange="getxiaoqu(this)" name="district" title="请选择所在区县">
                        <option value="">选择区域</option>
                        <volist name="area" id="vo">
                            <option value="{$vo.id}">{$vo.name}</option>
                        </volist>
                    </select>
                    <!-- <input type="text" name="address" id="address" class="input-txt"   placeholder="详细地址"/> -->
                </dd>
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="card"><em>*</em>小区</label>
                </dt>
                <dd class="opt">
                    <select onchange="getlou(this)" id="xiaoqu" name="xiaoqu"  title="请选择所在小区">
                        <option value="">选择小区</option>
                        <volist name="xiaoqu" id="vo">
                            <option value="{$vo.id}" >{$vo.name}</option>
                        </volist>
                    </select>
                    <select onchange="getfang(this)" id="lou" name="lou"  title="请选择所在单元">
                        <option value="">选择单元</option>
                        <volist name="luo" id="vo">
                            <option value="{$vo.id}" >{$vo.name}</option>
                        </volist>
                    </select>
                    <select id="fang" name="fang"  title="请选择所在房间号">
                        <option value="">选择房间号</option>
                        <volist name="fang" id="vo">
                            <option value="{$vo.id}" >{$vo.name}</option>
                        </volist>
                    </select>
                </dd>
            </dl>
            <div class="bot"><a href="JavaScript:void(0);" onclick="checkUserUpdate();" class="ncap-btn-big ncap-btn-green" id="submitBtn">确认提交</a></div>
        </div>
    </form>
</div>
<script type="text/javascript">
    function checkUserUpdate(){
       
        var phone = $('input[name="phone"]').val();
        var name = $.trim($('input[name="username"]').val());
        var card = $.trim($('input[name="card"]').val());
        var error ='';
        if(name == ''){
            error += "姓名不能为空\n";
        }
         if(card == ''){
            error += "身份证号不能为空不能为空\n";
        }
        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        $('#add_form').submit();
    }


/**
 * 获取小区
 */
function getxiaoqu1(t){
    var community_id = $(t).val();
    // var url = '/index.php?m=Admin&c=Api&a=getXiaoqu&level=4&community_id='+community_id;
    var url = '/index.php?m=Admin&c=Api&a=getXiaoqu&level=4&community_id=3';
    $.ajax({
        type : "GET",
        url  : url,
        error: function(request) {
            alert("服务器繁忙, 请联系管理员!");
            return;
        },
        success: function(v) {
            v = '<option value="0">选择小区</option>'+ v;
            $('#xiaoqu').empty().html(v);
        }
    });
}

    /**
     * 获取小区
     */
    function getxiaoqu(t){
        var parent_id = $(t).val();
        // var url = '/index.php?m=Admin&c=Api&a=getXiaoqu&level=4&community_id='+community_id;
        var url = '/index.php?m=Admin&c=Api&a=getXiaoqu&level=4&community_id=3';
        $.ajax({
            type : "GET",
            url  : url,
            error: function(request) {
                alert("服务器繁忙, 请联系管理员!");
                return;
            },
            success: function(v) {
                v = '<option value="0">选择小区</option>'+ v;
                $('#xiaoqu').empty().html(v);
            }
        });
    }

/**
 * 获取单元
 */
function getlou(t){
    var parent_id = $(t).val();
    var url = '/index.php?m=Admin&c=Api&a=getlou&level=5&parent_id='+parent_id;
    $.ajax({
        type : "GET",
        url  : url,
        error: function(request) {
            alert("服务器繁忙, 请联系管理员!");
            return;
        },
        success: function(v) {
            v = '<option value="0">请选择单元</option>'+ v;
            $('#lou').empty().html(v);
        }
    });
}



/**
 * 获取单元
 */
function getfang(t){
    var parent_id = $(t).val();
    var url = '/index.php?m=Admin&c=Api&a=getfang&level=6&parent_id='+parent_id;
    $.ajax({
        type : "GET",
        url  : url,
        error: function(request) {
            alert("服务器繁忙, 请联系管理员!");
            return;
        },
        success: function(v) {
            v = '<option value="0">请选择单元</option>'+ v;
            $('#fang').empty().html(v);
        }
    });
}
</script>
</body>
</html>